<!DOCTYPE html SYSTEM "http://www.thymeleaf.org/dtd/xhtml1-strict-thymeleaf-4.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org">

<head th:include="common/common :: jscss2">
    <title>详情</title>
</head>
<body>

<div class="layui-fluid">

    <blockquote class="layui-crumb">
        合同管理>
        <a lay-href="/contract/record/list.action">合同列表</a>
    </blockquote>

    <div class="layui-card">
        <div th:replace="contract/record/_tab::tab"></div>

        <div class="layui-card-body">
            <form method="post" action="" class="layui-form" lay-filter="zmn-form">
                <input type="hidden" name="contractId" th:value="${obj.contractId}">
                <input type="hidden" name="contractNo" th:value="${obj.contractNo}">
                <input type="hidden" name="sort" th:value="${obj.sort}">

                <div class="layui-split">&nbsp;</div>

                <div class="layui-form-item" th:if="${obj.contractId > 0}">
                    <label class="layui-form-label">合同编号：</label>
                    <div class="layui-input-block">
                        <div class="layui-form-mid">
                            <span th:text="${obj.contractNo}">contractNo</span>
                        </div>
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label layui-form-required">合同名称：</label>
                    <div class="layui-input-inline" style="width:300px">
                        <input type="text" placeholder="不超过30个字符" name="name" th:value="${obj.name}" lay-verify="required" autocomplete="off" class="layui-input" maxlength="30"/>
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">标的金额：</label>
                    <div class="layui-input-inline" style="width:300px">
                        <input type="text" placeholder="有金额时填写" lay-verify="bigAmount" name="subjectAmount" th:value="${obj.subjectAmount == 0 ? '':obj.subjectAmountYuan}" autocomplete="off" class="layui-input" maxlength="14"/>
                    </div>
                    <div class="layui-input-inline" style="width:160px;">
                        <label class="layui-form-mid">$</label>
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label layui-form-required">合同主体：</label>
                    <div class="layui-input-inline" style="width:300px">
                        <input type="text" name="subject" lay-verify="required" th:value="${obj.subject}" autocomplete="off" class="layui-input" maxlength="45"/>
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label layui-form-required">合同始期：</label>
                    <div class="layui-input-inline">
                        <input type="text" id="contractBeginDay" name="contractBeginDay" placeholder="yyyy-MM-dd" class="layui-input"
                               th:value="${obj.contractBeginDay}"
                               autocomplete="off" lay-verify="required"/>
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label layui-form-required">合同终期：</label>
                    <div class="layui-input-inline">
                        <input type="text" id="contractEndDay" name="contractEndDay" placeholder="yyyy-MM-dd" class="layui-input"
                               th:value="${obj.contractEndDay}"
                               autocomplete="off" lay-verify="required"/>
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label layui-form-required">合同类型：</label>
                    <div class="layui-input-inline" style="width:300px">
                        <select lay-filter="contractType" id="contractType" name="contractType" lay-search lay-verify="required">
                            <option value="" th:selected="${0 == obj.contractType}">全部</option>
                            <option th:each="category:${contractTypes}" th:value="${category.code}" th:selected="${category.code == obj.contractType}" th:text="${category.name}"/>
                        </select>
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label layui-form-required">签订日期：</label>
                    <div class="layui-input-inline">
                        <input type="text" id="signDay" name="signDay" placeholder="yyyy-MM-dd" class="layui-input"
                               th:value="${obj.signDay}"
                               autocomplete="off" lay-verify="required"/>
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label layui-form-required">是否机密：</label>
                    <div class="layui-input-inline" style="width:300px">
                        <input type="radio" name="secret" value="2"
                               th:checked="${obj.secret == 2 || obj.secret == null}" title="是" lay-verify="required">
                        <input type="radio" name="secret" value="1"
                               th:checked="${obj.secret == 1}" title="否" lay-verify="required">
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label layui-form-required">合同扫描件：</label>
                    <div id="scanFiles">
                        <zmn th:each="contractFileRecord, iterStat:${contractScanCopys}">
                            <div class="singleFile layui-input-block">
                                <div class="layui-input-inline" style="width: auto">
                                    <a name="scanFileSrc" th:id="${'scanFileSrc'+iterStat.index}" th:href="${contractFileRecord.fileSrc}" th:text="${T(com.zmn.plat.business.impl.upload.UrlUtils).getUrlFileName(contractFileRecord.fileSrc)}" class="layui-form-label uploadScanFile" style="width: auto;" download="">我是文件名</a>
                                    <span name="scanFileSize" th:value="${contractFileRecord.fileSize}" id="fileSize" class="layui-form-label" th:text="${#numbers.formatDecimal(contractFileRecord.fileSize*1.0/1024, 1, 2)+'KB'}" style="width: auto; color: #9F9F9F;">16.66KB</span>
                                    <a class="layui-form-label" th:onclick="deleteFile('scanFileSrc'+[[${iterStat.index}]])" style="width:auto;color: #00a0e9">
                                        删除
                                    </a>
                                </div>
                                <div class="layui-split">&nbsp;</div>
                            </div>
                        </zmn>
                    </div>

                    <div class="layui-input-block">
                        <div class="layui-input-inline">
                            <a href="javascript:void(0)" id="scanFileUpload" style="color: #00a0e9">
                                &nbsp;&nbsp;&nbsp;&nbsp;+添加文件
                            </a>
                            <span style="color: #9F9F9F;">(不超过25M)</span>
                        </div>
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">附加协议/子合同：</label>
                    <div id="sonFiles">
                        <zmn th:each="contractFileRecord, iterStat:${sonContracts}">
                            <div class="singleFile layui-input-block">
                                <div class="layui-input-inline" style="width: auto">
                                    <a name="sonFileSrc" th:id="${'sonFileSrc'+iterStat.index}" th:href="${contractFileRecord.fileSrc}" th:text="${T(com.zmn.plat.business.impl.upload.UrlUtils).getUrlFileName(contractFileRecord.fileSrc)}" class="layui-form-label uploadSonFile" style="width: auto;" download="">我是文件名</a>
                                    <span name="sonFileSize" th:value="${contractFileRecord.fileSize}" id="fileSize" class="layui-form-label" th:text="${#numbers.formatDecimal(contractFileRecord.fileSize*1.0/1024, 1, 2)+'KB'}" style="width: auto; color: #9F9F9F;">16.66KB</span>
                                    <a class="layui-form-label" th:onclick="deleteFile('sonFileSrc'+[[${iterStat.index}]])" style="width:auto;color: #00a0e9">
                                        删除
                                    </a>
                                </div>
                                <div class="layui-split">&nbsp;</div>
                            </div>
                        </zmn>
                    </div>

                    <div class="layui-input-block">
                        <div class="layui-input-inline">
                            <a href="javascript:void(0)" id="sonFileUpload" style="color: #00a0e9">
                                &nbsp;&nbsp;&nbsp;&nbsp;+添加文件
                            </a>
                            <span style="color: #9F9F9F;">(不超过25M)</span>
                        </div>
                    </div>
                </div>


                <div class="layui-form-item">
                    <label class="layui-form-label">合同履行情况：</label>
                    <div class="layui-input-inline" style="width:300px">
                        <select lay-filter="performance" id="performance" name="performance" lay-search>
                            <option value="" th:selected="${0 == obj.contractType}">全部</option>
                            <option value="1" th:selected="${obj.performance == 1}">进行中</option>
                            <option value="2" th:selected="${obj.performance == 2}">已完成</option>
                        </select>
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">合同状态：</label>
                    <div class="layui-input-inline" style="width:300px">
                        <select lay-filter="status" id="status" name="status" lay-search>
                            <option value="" th:selected="${0 == obj.status}">全部</option>
                            <option th:each="contractStatus:${contractStatusList}" th:value="${contractStatus.code}" th:selected="${contractStatus.code == obj.status}" th:text="${contractStatus.name}"/>
                        </select>
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">合同标的：</label>
                    <div class="layui-input-block" style="width: 1200px">
                        <div class="layui-inline">
                            <textarea style="width: 450px" name="contractObject" class="layui-textarea" th:text="${obj.contractObject}" maxlength="100"></textarea>
                        </div>
                    </div>
                </div>

                <div class="layui-card-header layui-margin-b"><b>经办信息</b></div>
                <div class="layui-form-item">
                    <label class="layui-form-label layui-form-required">经办人：</label>
                    <div class="layui-input-inline" id="agent" style="width:300px">
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label layui-form-required">所属公司：</label>
                    <div class="layui-input-inline" style="width:300px">
                        <select lay-filter="agentCompanyId" id="agentCompanyId" name="agentCompanyId" lay-search lay-verify="required">
                            <option value="" th:selected="${0 == obj.agentCompanyId}">全部</option>
                            <option th:each="company:${companys}" th:value="${company.key}" th:selected="${company.key == obj.agentCompanyId}" th:text="${company.value}"/>
                        </select>
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label layui-form-required">所属管理中心和部门：</label>
                    <div class="layui-input-inline" style="width:300px">
                        <select lay-filter="oneDeptId" id="oneDeptId" name="agentDeptOneId" lay-search lay-verify="required">
                            <option value=""></option>
                            <option th:each="dept:${oneDepts}" th:value="${dept.deptId}" th:selected="${dept.deptId == obj.agentDeptOneId}" th:text="${dept.deptName}"/>
                        </select>
                    </div>
                    <div class="layui-input-inline" style="width:300px">
                        <select id="deptId" name="agentDeptTwoId" lay-search>
                            <option value=""></option>
                            <option th:each="dept:${twoDepts}" th:value="${dept.deptId}" th:selected="${dept.deptId == obj.agentDeptTwoId}" th:text="${dept.deptName}"/>
                        </select>
                    </div>
                </div>

                <div class="layui-card-header layui-margin-b"><b>到期预警</b></div>
                <div class="layui-form-item">
                    <label class="layui-form-label">是否设置到期预警：</label>
                    <div class="layui-input-inline" style="width:300px">
                        <input type="radio" name="expirationAlert" value="2"
                               th:checked="${obj.expirationAlert == 2 || obj.expirationAlert == null}" title="是">
                        <input type="radio" name="expirationAlert" value="1"
                               th:checked="${obj.expirationAlert == 1}" title="否">
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">第一次预警时间：距离结束日期前</label>
                    <div class="layui-input-inline" style="width: 100px">
                        <input lay-verify="isDaysNumber" type="number" name="firstAlertDays" autocomplete="off" maxlength="10" class="layui-input"
                               th:value="${obj.firstAlertDays == null ? 30: obj.firstAlertDays}"
                               onkeyup="if(this.value.length>7) this.value=this.value.slice(0,8);value=value.replace(/^(0+)|[^\d]+/g,'')">
                    </div>
                    <label class="layui-form-label">预警接收员：</label>
                    <div class="layui-input-inline" id="firstAlertReceiver1" style="width: 180px">
                    </div>
                    <div class="layui-input-inline" id="firstAlertReceiver2" style="width: 180px">
                    </div>
                    <div class="layui-input-inline" id="firstAlertReceiver3" style="width: 180px">
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">第二次预警时间：距离结束日期前</label>
                    <div class="layui-input-inline" style="width: 100px">
                        <input lay-verify="isDaysNumber" type="number" name="secondAlertDays" autocomplete="off" maxlength="10" class="layui-input"
                               th:value="${obj.secondAlertDays}"
                               onkeyup="if(this.value.length>7) this.value=this.value.slice(0,8);value=value.replace(/^(0+)|[^\d]+/g,'')">
                    </div>
                    <label class="layui-form-label">预警接收员：</label>
                    <div class="layui-input-inline" id="secondAlertReceiver1" style="width: 180px">
                    </div>
                    <div class="layui-input-inline" id="secondAlertReceiver2" style="width: 180px">
                    </div>
                    <div class="layui-input-inline" id="secondAlertReceiver3" style="width: 180px">
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">是否设置过期预警：</label>
                    <div class="layui-input-inline" style="width:300px">
                        <input type="radio" name="overdueAlert" value="2"
                               th:checked="${obj.overdueAlert == 2 || obj.overdueAlert == null}" title="是" >
                        <input type="radio" name="overdueAlert" value="1"
                               th:checked="${obj.overdueAlert == 1}" title="否">
                    </div>
                    <label class="layui-form-label" style="margin-left: -200px">预警接收员：</label>
                    <div class="layui-input-inline" id="overdueAlertReceiver1" style="width: 180px;margin-left: -50px">
                    </div>
                    <div class="layui-input-inline" id="overdueAlertReceiver2" style="width: 180px;">
                    </div>
                    <div class="layui-input-inline" id="overdueAlertReceiver3" style="width: 180px;">
                    </div>
                </div>


                <zmn th:if="${obj.contractId > 0}">
                    <div class="layui-card-header layui-margin-b"><b>操作记录</b></div>

                    <div class="layui-form-item layui-form-item-sm">
                        <label class="layui-form-label">修改人/时间：</label>
                        <div class="layui-input-block">
                            <div class="layui-form-mid layui-word-aux" th:text="${obj.updater} + '&nbsp;/&nbsp;' + ${#dates.format(obj.updateTime, 'yyyy-MM-dd HH:mm:ss')}">修改人/时间</div>
                        </div>
                    </div>
                    <div class="layui-form-item layui-form-item-sm">
                        <label class="layui-form-label">创建人/时间：</label>
                        <div class="layui-input-block">
                            <div class="layui-form-mid layui-word-aux" th:text="${obj.creater} + '&nbsp;/&nbsp;' + ${#dates.format(obj.createTime, 'yyyy-MM-dd HH:mm:ss')}">创建人/时间</div>
                        </div>
                    </div>
                </zmn>

                <div class="layui-split">&nbsp;</div>

                <div class="layui-form-item submit">
                    <div class="layui-input-block">
                        <button th:if="${#authPermit.checkPermit('/contract/record/addEdit.action')}" class="layui-btn" lay-submit="" lay-filter="zmn-form-submit">保存</button>
                        <button type="reset" class="layui-btn layui-btn-primary"
                                onclick="layui.admin.events.closeThisTabs();">关闭
                        </button>
                    </div>
                </div>
            </form>
        </div>
    </div>

</div>

<script type="text/javascript" th:inline="javascript">
    var json = {
        obj: [[${obj}]],
        oneDepts: [[${oneDepts}]],
        twoDepts: [[${twoDepts}]]
    };

    layui.config({
        version: 20200218,
        base: "/static/lay/"
    }).extend({
        index: "lib/index",
        contract_record_detail_edit_js: "contract/record/zmn.plat.contract.record.detail.edit",
    }).use(['index', 'contract_record_detail_edit_js']);
</script>
</body>
</html>